package com.bean.search;

import cn.hutool.core.bean.BeanUtil;
import cn.zhxu.bs.MapSearcher;
import com.bean.search.req.SearchUser2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author lkz
 * @className SearchController
 * @description
 * @date 2024/4/19 15:15
 **/
@RestController
@RequestMapping("search")
public class SearchController {



    @Autowired
    private MapSearcher mapSearcher;





    @GetMapping("test")
    public String test(@RequestParam Map<String,Object> paramMap){

        /**
         * 测试模糊查询
         */
        //List<Map<String, Object>> maps = mapSearcher.searchList(SearchUser.class, paramMap);
        // 测试动态字段 不要放在实体中 或者不能重复
        List<Map<String, Object>> maps = mapSearcher.searchList(SearchUser2.class, paramMap);

        List<SearchUser2> searchUser2s = BeanUtil.copyToList(maps, SearchUser2.class);

        return null;

    }

}
